package com.peppa.xtext.esaml.tests

import com.google.inject.Inject
import com.peppa.xtext.esaml.esaml.Model
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.extensions.InjectionExtension
import org.eclipse.xtext.testing.util.ParseHelper
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import org.eclipse.xtext.serializer.ISerializer
import org.eclipse.xtext.resource.SaveOptions

@ExtendWith(InjectionExtension)
@InjectWith(ESAMLInjectorProvider)
class ESAMLFormatingTest {

	@Inject extension ParseHelper<Model>
	@Inject extension ISerializer

	def String format(String str) {
		str.parse.serialize(SaveOptions.newBuilder.format().getOptions())
	}


	@Test
	def void pattern() {
		val str = '''		system SystemType			features				output data port inputDataPort ;				require data access requireDataAccess ;
			properties				stateval bool variableName ;		end		subsystem SubSystemType			properties				bool & ref -> system SystemType variableName ;
		end		system implementation SystemType . systemImpl		end
		'''
		System.out.println(str.format)
	}

}
